<template>
	<!--发起节点-->
	<promoter v-if="nodeConfig.type==0" v-model="nodeConfig"></promoter>
	<!--审批节点-->
	<approver v-if="nodeConfig.type==1" v-model="nodeConfig"></approver>
	<!--抄送节点-->
	<send v-if="nodeConfig.type==2" v-model="nodeConfig"></send>
	<!--分支节点-->
	<branch v-if="nodeConfig.type==4" v-model="nodeConfig">
		<template v-slot="slot">
			<node-wrap v-if="slot.node" v-model="slot.node.childNode" ></node-wrap>
		</template>
	</branch>
	<!--并行节点-->
	<parallel v-if="nodeConfig.type==5" v-model="nodeConfig">
		<template v-slot="slot">
			<node-wrap v-if="slot.node" v-model="slot.node.childNode"></node-wrap>
		</template>
	</parallel>

	<!--延时节点-->
	<scheduler v-if="nodeConfig.type==6" v-model="nodeConfig"></scheduler>

	<!--事件节点-->
	<task v-if="nodeConfig.type==7" v-model="nodeConfig"></task>
	<!--同意/拒绝-->
	<verify v-if="nodeConfig.type==8" v-model="nodeConfig">
		<template v-slot="slot">
			<node-wrap v-if="slot.node" v-model="slot.node.childNode"></node-wrap>
		</template>
	</verify>

	<node-wrap v-if="nodeConfig.childNode" v-model="nodeConfig.childNode"></node-wrap>

</template>

<script>
	import approver from './nodes/approver'
	import promoter from './nodes/promoter'
	import branch from './nodes/branch'
	import parallel from './nodes/parallel'
	import send from './nodes/send'
	import scheduler from './nodes/scheduler.vue'
	import task from './nodes/task.vue'
	import verify from './nodes/verify.vue'
	export default {
		props: {
			modelValue: { type: Object, default: () => {} },
		},
		components: {
			approver,
			promoter,
			branch,
			send,
			parallel,
			scheduler,
			task,
			verify
		},
		data() {
			return {
				nodeConfig: {},
			}
		},
		watch:{
			modelValue(val){
				this.nodeConfig = val
			},
			nodeConfig(val){
				this.$emit("update:modelValue", val)
			}
		},
		mounted() {
			this.nodeConfig = this.modelValue
		},
		methods: {

		}
	}
</script>

<style>
</style>
